import time

def a():
    while True:
        print('---1---')
        yield None
        time.sleep(0.5)

def b():
    while True:
        print('---2---')
        yield None
        time.sleep(0.5)

if __name__ == '__main__':
    t1 = a()
    t2 = b()
    while True:
        next(t1)
        next(t2)